module StochasticSimulation.ChemicalReaction.DataStructures

open System
open StochasticSimulation.ChemicalReaction.ChemicalReaction


type DependencyGraph( ) = 

    let mutable dependencies = [] :> list<Reaction>

    member dg.Add(reaction) = 
        dependencies <- reaction::dependencies
        dependencies.Length
    
    member dg.Remove(reaction) = 
        false
    
    member dg.Affects(reaction : Reaction)  = 
        dependencies |> Seq.filter ( fun r -> reaction.Affects(r) )
            
    
    member dg.Depends(reaction : Reaction) = 
        dependencies |> Seq.filter ( fun r -> reaction.Depends(r) )
            
    member dg.Length = dependencies.Length